<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String baseBath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>Title</title>
    <base href="<%=baseBath%>">
    <%@ include file="../common_css.jsp"%>
</head>
<body>

<form class="layui-form" style="width:80%;">
    <input name="id" type="hidden" value="${user.id}"/>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input userName"
                   lay-verify="required" name="username" id="userName"  value="${user.username}" placeholder="请输入用户名">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input userEmail"
                   lay-verify="phone" name="phone" value="${user.phone}" id="phone" placeholder="请输入手机号">
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input userName"
                   lay-verify="required" name="name" id="trueName" value="${user.name}" placeholder="请输入真实姓名">
        </div>
    </div>
    <c:if test="${user.id==null}">
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" class="layui-input userName"
                   lay-verify="required" name="password" id="password" value="" placeholder="请输入密码">
        </div>
    </div>
    </c:if>
    <div class="magb15 layui-col-md4 layui-col-xs12">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="roleId"   >
                <c:forEach var="role" items="${roles}">
                    <option value="${role.id}"  <c:if test="${user.role.id==role.id}">selected</c:if> >${role.role}</option>
                </c:forEach>
            </select>
        </div>
    </div>

    <br/>
    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-lg" lay-submit=""
                    lay-filter="addOrUpdateUser">确认
            </button>
            <button type="reset" class="layui-btn layui-btn-lg layui-btn-normal">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="com/js/user/add.update.js"></script>
</body>
</html>
